#ifndef FASYS_LIBS_CHANNEL_CLIENT_SUBSCRIBE_MEHTOD_HPP
#define FASYS_LIBS_CHANNEL_CLIENT_SUBSCRIBE_MEHTOD_HPP

#include <fas/adv/json_rpc3/method.hpp>
#include "types.hpp"
#include "tags.hpp"

namespace fasys{ namespace client{ namespace channel{

namespace aa = ::fas::aop;
namespace ap = ::fas::pattern;
namespace ad = ::fas::adv;
namespace ajr = ::fas::adv::json_rpc3;

struct subscribe_method
{
  const char *name() const { return "subscribe"; }

  typedef subscribe_response_json invoke_notify;
  /*typedef message_json invoke_request;
  typedef message_json invoke_response;
  */

  typedef subscribe_request_json call_notify;
  /*typedef message_json call_request;
  typedef message_json call_response;
  */

  typedef subscribe_request_json::target request_type;
  typedef subscribe_response_json::target response_type;

  template<typename T>
  void clear(T&) { }

  template<typename T>
  void notify(T& t, response_type& cmd )
  {
    t.incoming(cmd);
  }
};

typedef aa::tag_list_n<
  aa::tag<_subscribe_>,
  aa::gtag< ajr::_gmethod_ >,
  aa::gtag< ad::_cleaner_ >
>::type subscribe_method_tag_list;

struct subscribe_method_advice
  : aa::advice<
      subscribe_method_tag_list,
      ajr::method<subscribe_method>
    >
{};

}}}

#endif
